﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace dll_DynamicDataDisplay.ViewModels
{
    /// <summary>
    /// 图表类
    /// </summary>
    [Serializable]
    public class Vm_Chart : INotifyPropertyChanged
    {
        #region NotifyProperty

        /// <summary>
        /// 显示集合
        /// </summary>
        public ObservableCollection<Vm_Element> ElementCollection
        {
            get { return _ElementCollection; }
            set
            {
                if (_ElementCollection != value)
                {
                    _ElementCollection = value;
                    this.OnPropertyChanged("ElementCollection");
                }
            }
        }
        private ObservableCollection<Vm_Element> _ElementCollection = new ObservableCollection<Vm_Element>();

        #endregion

        #region NotifyPropertyChanged

        /// <summary>
        /// 属性变化委托
        /// </summary>
        [field: NonSerialized]
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// 属性变化响应
        /// </summary>
        /// <param name="propertyName"></param>
        public virtual void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
        #endregion
    }
}
